export let getBase64Image={
	//base64位编码
	getBase64Image:function(path){
    var img = new Image();
	    img.src = path;
	var canvas = document.createElement("canvas");
	var width = img.width;
	var height = img.height;
	// calculate the width and height, constraining the proportions  
	var scale = 4;
	width = width / scale;
	//480  你想压缩到多大，改这里
	height = height / scale;
	var rate = 1;
	canvas.width = width; /*设置新的图片的宽度*/
	canvas.height = height; /*设置新的图片的长度*/
	var ctx = canvas.getContext("2d");
	ctx.drawImage(img, 0, 0, width, height); /*绘图*/
	var dataURL = canvas.toDataURL("image/jpeg", 0.8);

	 return dataURL;
	}
}
